﻿using University.Workshop.DataAccess;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using University.Workshop.Model;
using University.Workshop.Business;
using System.Data.SqlClient;

namespace University.Workshop.Tests
{
    
    
    /// <summary>
    ///This is a test class for ClientUpdaterTest and is intended
    ///to contain all ClientUpdaterTest Unit Tests
    ///</summary>
    [TestClass()]
    public class ClientUpdaterTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for UpdateClient
        ///</summary>
        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void UpdateClientBlankTest()
        {
            string fullName = "";
            string id = "";
            string telephone = "";
            int ids = 1;
            ClientManager.ValidateForUpdating(fullName, id, telephone, ids);
        }

        /// <summary>
        ///A test for UpdateClient
        ///</summary>
        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void UpdateClientNullTest()
        {
            Client client = new Client();
            int ids = 1;
            ClientManager.ValidateForUpdating(client.FullName, client.ClientId, client.Telephone, ids);
        }

        /// <summary>
        ///A test for UpdateClient
        ///</summary>
        [TestMethod()]
        public void UpdateClientTest1()
        {

            Client client = new Client { FullName = "Daniel Rocabado", ClientId = "12345", Telephone = "4412345" };  // TODO: Initialize to an appropriate value
            ClientManager.ValidateForUpdating(client.FullName, client.ClientId, client.Telephone, 1);

            Client client2 = new Client { FullName = "Daniel Rocabado", ClientId = "12345", Telephone = "4412345" };  // TODO: Initialize to an appropriate value
            ClientManager.ValidateForUpdating(client2.FullName, client2.ClientId, client2.Telephone, 1);
        }
       

        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void UpdateClientTest2()
        {
            Client client = null;
            int ids = 1;
            ClientUpdater.UpdateClient(client, ids);
        }

    }
}
